import { Controller, Get, Post, Body, Param, Delete, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { ExCode_Service } from './exCode.service';
import { ExCode_Create_Dto } from './assets/exCode.dto';
import { ExCode_Find_Dto } from './assets/exCode.dto';
import { util_ApiResponse_Base } from '@/common/util/apiResponse';
import { util_Index_ReturnContent } from '@/common/util/index';

@Controller('/adm/exCode')
@ApiTags('exCode 兑换码')
export class ExCode_Controller {
  constructor(private readonly exCode_Service: ExCode_Service) {}

  @Post('/add')
  @util_ApiResponse_Base({
    dataType: 'dataType_add',
  })
  async exCode_Create(@Body() body: ExCode_Create_Dto) {
    return util_Index_ReturnContent(await this.exCode_Service.exCode_Create(body));
  }

  @Get('list')
  @util_ApiResponse_Base({
    dataType: 'dataType_list',
  })
  async exCode_FindByPage(@Query() query: ExCode_Find_Dto) {
    return util_Index_ReturnContent(await this.exCode_Service.exCode_FindByPage(query));
  }

  @Delete('/delete/:id')
  @util_ApiResponse_Base({
    dataType: 'dataType_delete',
  })
  async exCode_Remove(@Param('id') id: string) {
    return util_Index_ReturnContent(await this.exCode_Service.exCode_Remove(+id));
  }
}
